package com.jihui.user.server;

import com.jihui.user.dao.UserDao;
import com.jihui.user.model.JihuiUser;
import com.jihui.user.model.UserManager;
import com.jihui.user.service.UserService;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by wangjin on 2017/5/19.
 */
@Component("userManager")
@RestController
public class UserManagerImpl implements UserManager {
    private final UserService userService;
    private final UserDao userDao;

    @Autowired
    public UserManagerImpl(UserService userService, UserDao userDao) {
        this.userService = userService;
        this.userDao = userDao;
    }

    @Override
    public Integer add(Integer a, Integer b) {
        return 1;
    }

    @Override
    public JihuiUser findById(Long userId) {
        return userDao.findById(userId);
    }

    @Override
    public JihuiUser login(String userName, String password, String ip) throws Exception {
        return userService.login(userName,password,ip);
    }
}
